#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=5e3+100;
typedef long long LL;
const LL mod=1e9+7;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
LL pre[maxn];
LL dp[maxn][maxn];
int main(void){
   cin.tie(0);std::ios::sync_with_stdio(false);
   LL n,a,b,k;cin>>n>>a>>b>>k;
   dp[0][a]=1;
   for(LL i=1;i<=k;i++){
       pre[0]=0;
       for(LL j=1;j<=n;j++){
          pre[j]=(pre[j-1]%mod+dp[i-1][j]%mod)%mod;
       }
       for(LL j=1;j<=n;j++){
          if(j==b) continue;
          if(j<b){
             dp[i][j]=(pre[ (abs(b-j)-1)/2+j]%mod+mod)%mod;
          }
          if(j>b){
             dp[i][j]=(pre[n]%mod-pre[j-(abs(b-j)+1)/2]%mod+mod)%mod;
          }
          dp[i][j]=(dp[i][j]%mod-dp[i-1][j]%mod+mod)%mod;
       }
   }
   LL ans=0;
   for(LL j=1;j<=n;j++){
       ans=(ans%mod+dp[k][j]%mod)%mod;
   }
   cout<<ans<<"\n";
   return 0;
}
